﻿using PluginService.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace FaceDetectiveWindowsService
{
    public partial class FaceDeteiveService : ServiceBase
    {
        public FaceDeteiveService()
        {
            InitializeComponent();
        }

        Policy.PolicyServer _policyServer= null;

        FaceDeteiveHelper _faceDeteiveHelper = new FaceDeteiveHelper();

        protected override void OnStart(string[] args)
        {
            if (_policyServer == null)
            {
                _policyServer = new Policy.PolicyServer(string.Format("{0}{1}", Util.GetWindowsServiceInstallPath("FaceDeteiveService").Replace("FaceDetectiveWindowsService.exe",""), "clientaccesspolicy.xml"));
            }
            _faceDeteiveHelper.Init();
            _faceDeteiveHelper.Start();
            
        }

        protected override void OnStop()
        {
        }
    }
}
